//Mapscript by Predator from FalX&


game_manager //needed
{
	spawn
	{
			create
		  {
		 	scriptName "bugfix1"
			classname "func_fakebrush"
			origin "-4933 -2450 -900"
			contents 8 // CONTENTS_PLAYERCLIP
			mins "-70 -70 -300"
			maxs "70 70 300"
		   }
		  
		   
	    wm_axis_respawntime 15
		wm_allied_respawntime 20
		wm_set_round_timelimit 15
		wait 3000 //wait 3sec before moving
		wm_announce "^/The first mission from Helicopter Assault season"
		wait 100
		construct scari
	}
		        trigger allies_win   
        {   
                wm_announce "The Allies escaped with the gold!" 
                wm_setwinner 1

                wait 3000

                wm_endround
 
        } 
}

//ELICOPTERUUUU 1
mover_shell //your original brushwork
{
	spawn
	{
	    wait 800
		attachtotag master_mover aici //matching up origins of both script_movers
		setstate mover_shell invisible
	}
	trigger apare
	{
	setstate mover_shell default
	}
	trigger dispare
	{
	setstate mover_shell invisible
	}
}
master_mover //this script_mover has everything else attached to it. 
{
	spawn
	{
		setdamagable master_mover 0 // This makes the entity invincible, a health key is needed for gun to work properly. If you want it damagable just remove this line.
		wait 500
		followspline 0 heli2_path_08 length 300 wait
		wait 100
		setstate master_mover invisible
	}
	trigger sunet
	{
	playsound sound/UJE_the_ghetto/heli.wav looping volume 1024
	}
	trigger dispare
	{
	setstate master_mover invisible
	}
	trigger apare
	{
	setstate master_mover default
	}

	trigger miscare
	{
followspline 0 heli2_path_09 200 wait length 304
followspline 0 heli2_path_10 200 wait length 304
followspline 0 heli2_path_11 200 wait length 304
wait 8000
followspline 0 heli2_path_00 200 wait length 304
followspline 0 heli2_path_01 200 wait length 304
followspline 0 heli2_path_02 200 wait length 304
followspline 0 heli2_path_03 200 wait length 304
followspline 0 heli2_path_04 200 wait length 304
followspline 0 heli2_path_05 200 wait length 304
followspline 0 heli2_path_05_intermediar 200 wait length 304
trigger urcatura1 apare
followspline 0 heli2_path_06 200 wait length 0
trigger mover_shell dispare
trigger master_mover dispare
trigger master_mover2 apare
trigger mover_shell2 apare
wait 500
setstate heli2_fiu default
   }
}
   heli2_go
{
    spawn
	{
	setstate heli2_fiu invisible
	}
	trigger main
	{
	    trigger h_left_door2 close
		trigger h_right_door2 close
		setstate heli2_fiu invisible
		wait 300
		trigger master_mover2 continua_tu
	}
}
mover_shell2
{
    spawn
	{
	    wait 100
		attachtotag master_mover2 tag_shell2
		setstate mover_shell2 default
	}
	trigger dispare
	{
	setstate mover_shell2 invisible
	}
	trigger apare
	{
	setstate mover_shell2 default
	}
}
master_mover2 //this script_mover has everything else attached to it. 
{
	spawn
	{
	    wait 700
		setdamagable master_mover2 0 // This makes the entity invincible, a health key is needed for gun to work properly. If you want it damagable just remove this line.
		followspline 0 heli2_path_07 length 200 wait
		setstate master_mover2 default
	}
	trigger sunet
	{
	playsound sound/UJE_the_ghetto/heli.wav looping volume 1024
	}
	trigger dispare
	{
	setstate master_mover2 invisible
	}
	trigger apare
	{
	setstate master_mover2 default
	}

	trigger continua_tu
	{
followspline 0 heli2_path_08 150 wait length 0
trigger mover_shell2 dispare
trigger master_mover apare
trigger mover_shell apare
trigger master_mover miscare
trigger urcatura1 dispare
wait 300
followspline 0 heli2_path_07 200 wait length 0
trigger master_mover2 dispare
    }
}
//GATA ELICOPTERUU
 //==============================================
//===============STEAGUL Heliportului==============
//==============================================
castletop_flag
{
			spawn
			{
						accum 0 set 1			//axisownflag 0 alliesownflag 1
						accum 1 set 18		// totaltimeleft ALWAYS RESETS TO 30
						trigger castletop_flag time_is_up
			}
			trigger axis_capture
			{
						accum 1 set 18
						accum 0 set 0
						wm_announce "Axis Have Control of the Heliport Flag!"
						wm_teamvoiceannounce 0 "axis_hq_objective_secure"
						wm_teamvoiceannounce 1 "allies_hq_objective_lost"
						wm_objective_status 1 1 2
						wm_objective_status 1 0 1
			}
			trigger allied_capture
			{
						accum 0 set 1
						wm_announce "Allies Have Taken The Control of the Heliport!"
						trigger self run_timer
						wm_teamvoiceannounce 0 "axis_hq_objective_lost"
						wm_teamvoiceannounce 1 "allies_hq_objective_taken"
						wm_objective_status 1 1 1
						wm_objective_status 1 0 2

			}
			trigger run_timer
			{
						accum 0 abort_if_not_equal 1
						accum 1 trigger_if_equal 0 castletop_flag time_is_up
						accum 1 inc -1
						trigger self down_ones
						wait 1000
						trigger self run_timer
			}
			trigger time_is_up		
			{	
			            wait 100
						accum 0 set 0
						//wm_announce "Allies captured the Heliport^1!!"
						wm_teamvoiceannounce 0 "allies_hq_objective_captured"
						wm_teamvoiceannounce 1 "allies_hq_objective_captured"
                        trigger tank_spawn_wobj on
                        setautospawn    "tank spawn"   1
                        trigger axosu_wobj on
                        setautospawn    "axosu"   0
						wait 600
						trigger usa_inchisa dispare
		                trigger usa_deschisa apare
						setstate heli2_fiu default
						setstate heli2_fiuw default
						trigger scaroace setup
						setstate castletop_flag invisible
						wait 100
						trigger master_mover2 sunet
                        trigger master_mover sunet
                        trigger master_moverw sunet
                        trigger master_moverww sunet
			}
						
			trigger down_ones
			{
			        accum 1 trigger_if_equal 18 castletop_flag run18
					accum 1 trigger_if_equal 17 castletop_flag run17
					accum 1 trigger_if_equal 16 castletop_flag run16
					accum 1 trigger_if_equal 15 castletop_flag run15
					accum 1 trigger_if_equal 14 castletop_flag run14
					accum 1 trigger_if_equal 13 castletop_flag run13
					accum 1 trigger_if_equal 12 castletop_flag run12
					accum 1 trigger_if_equal 11 castletop_flag run11
			        accum 1 trigger_if_equal 10 castletop_flag run10
			        accum 1 trigger_if_equal 9 castletop_flag run9
			        accum 1 trigger_if_equal 8 castletop_flag run8
					accum 1 trigger_if_equal 7 castletop_flag run7
					accum 1 trigger_if_equal 6 castletop_flag run6
					accum 1 trigger_if_equal 5 castletop_flag run5
					accum 1 trigger_if_equal 4 castletop_flag run4
					accum 1 trigger_if_equal 3 castletop_flag run3
					accum 1 trigger_if_equal 2 castletop_flag run2
					accum 1 trigger_if_equal 1 castletop_flag run1
			}
			trigger run18
			{
			}
			trigger run17
			{
			wm_announce "^>Now hold it for ^118 ^>seconds!"
			}
			trigger run16
			{
			}
			trigger run15
			{
			}
			trigger run14
			{
			}
			trigger run13
			{
			}
			trigger run12
			{
			}
			trigger run11
			{
			}
			trigger run10
			{
			wm_announce "^110 ^>Seconds Left^1!"
			}
			trigger run9
			{
			}
			trigger run8
			{
			}
			trigger run7
			{
			}
			trigger run6
			{
			}
			trigger run5
			{
			wm_announce	"^15.."
			}
			trigger run4
			{
			wm_announce	"^14.."
			}
			trigger run3
			{
					wm_announce	"^13.."
			}
			trigger run2
			{
					wm_announce	"^12.."
			}
			trigger run1
			{
					wm_announce	"^11.."
			}
  }
/////////////////////////////////////////////////////////////////////////////////////
/////////ALLIED MiniCp/////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
//MINI COMMAND POST nu conteaza ca vezi tu scari

scari
{
	spawn
	{
	    //accum 3 set 1
		//accum 5 set 1
		wait 200
		constructible_class 2
		trigger scari setup
	}

	trigger setup
	{
		setstate scari invisible
		setstate cutie_scari default
		setstate solid_cutie default
	}

	buildstart final
	{
		setstate scari underconstruction
		setstate cutie_scari default
		setstate solid_cutie default
	}

	built final
	{
	    wait 100
		setstate scari default
		setstate cutie_scari invisible
		setstate solid_cutie invisible
        //wm_announce	"The allies CP has been constructed!"
		//Schimbari de spawn
		//trigger blocada1 dispare
		//accum 3 abort_if_not_equal 1
		//trigger tank_spawn_wobj off
		//trigger cp_spawn_wobj on
        //setautospawn    "CP Spawn"   1
		//trigger lock_cp dispare //conditie blocajcp
		trigger enable_gold apare
	}
	death
	{
		setstate scari invisible
		setstate cutie_scari default
		setstate solid_cutie default
        //trigger cp_spawn_wobj off
		//trigger tank_spawn_wobj on
        //setautospawn    "tank spawn"   1		
		wm_announce	"The allies CP has been destroyed!"
		trigger enable_gold dispare
	}

	decayed final
	{
		setstate scari invisible
		setstate cutie_scari default
		setstate solid_cutie default
	}
}
//LIFT
elevator_trigger
{
	spawn
	{
	}

	trigger activate
	{
		trigger bottom_l_door close
		trigger bottom_r_door close

		wait 700

		trigger eldoor_l closelow
		trigger eldoor_r closelow

		wait 2000

		trigger eldoor_l move_up
		trigger eldoor_r move_up
		trigger elevator move_up

		//wait 2500
        wait 11500

		trigger top_l_door open
		trigger top_r_door open

		wait 700

		alertentity ding_trigger

		trigger eldoor_l openhigh
		trigger eldoor_r openhigh

		//wait 1000
          wait 5500

		wait 3000

		trigger top_l_door close
		trigger top_r_door close

		wait 700

		trigger eldoor_l closehigh
		trigger eldoor_r closehigh

		wait 2000

		trigger eldoor_l move_down
		trigger eldoor_r move_down
		trigger elevator move_down

		//wait 2500
		wait 11500

		trigger bottom_l_door open
		trigger bottom_r_door open

		wait 700

		trigger eldoor_l openlow
		trigger eldoor_r openlow
	}

}

elevator
{
	spawn
	{
	}

	trigger move_up
	{
		gotomarker elevator_uppos 100
	}

	trigger move_down
	{
		gotomarker elevator_downpos 100
	}
}

eldoor_l
{
	spawn
	{
	}

	trigger openlow
	{
		gotomarker eldoor_l_openlow 24
	}

	trigger closelow
	{
		gotomarker eldoor_l_closedlow 24
	}

	trigger move_up
	{
		gotomarker eldoor_l_closedhigh 100
	}

	trigger move_down
	{
		gotomarker eldoor_l_closedlow 100
	}

	trigger openhigh
	{
		gotomarker eldoor_l_openhigh 24
	}

	trigger closehigh
	{
		gotomarker eldoor_l_closedhigh 24
	}
}

eldoor_r
{
	spawn
	{
	}

	trigger openlow
	{
		gotomarker eldoor_r_openlow 24
	}

	trigger closelow
	{
		gotomarker eldoor_r_closedlow 24
	}

	trigger move_up
	{
		gotomarker eldoor_r_closedhigh 100
	}

	trigger move_down
	{
		gotomarker eldoor_r_closedlow 100
	}

	trigger openhigh
	{
		gotomarker eldoor_r_openhigh 24
	}

	trigger closehigh
	{
		gotomarker eldoor_r_closedhigh 24
	}


}

bottom_l_door
{
	spawn
	{
	}

	trigger open
	{
		gotomarker bottom_l_door_open 24
	}

	trigger close
	{
		gotomarker bottom_l_door_closed 24
	}
}

bottom_r_door
{
	spawn
	{
	}

	trigger open
	{
		gotomarker bottom_r_door_open 24
	}

	trigger close
	{
		gotomarker bottom_r_door_closed 24
	}
}

top_l_door
{
	spawn
	{
	}

	trigger open
	{
		gotomarker top_l_door_open 24
	}

	trigger close
	{
		gotomarker top_l_door_closed 24
	}
}

top_r_door
{
	spawn
	{
	}

	trigger open
	{
		gotomarker top_r_door_open 24
	}
	
	trigger close
	{
		gotomarker top_r_door_closed 24
	}
}
access_codes 
{ 
	spawn 
	{ 
		wait 200 
	} 

	trigger stolen 
	{ 
		wm_announce "The Allies have stolen Documents" 
	} 


	trigger returned 
	{ 
		wm_announce "The Axis have retrieved Documents" 
	} 

	trigger captured 
	{ 
		wm_announce "Allies win!" 
		trigger game_manager allies_win

	} 
} 

enable_gold
{
spawn
{
wait 500
setstate access_card_toi invisible
}
trigger dispare
{
wait 100
setstate access_card_toi invisible
}
trigger apare
{
wait 100
setstate access_card_toi default
}
}

usa_deschisa
{
spawn
{
setstate usa_deschisa invisible
}
trigger apare
{
setstate usa_deschisa default
}
}

usa_inchisa
{
spawn
{
setstate usa_inchisa default
}
trigger dispare
{
setstate usa_inchisa invisible
}
}
blocatura
{
	spawn
	{
		wait 200
		set	
			{
				health "50"
                constructible_class 1
			}
	}
	death
	{
	    wm_announce "Document fence is destroyed!"
	}
}
//SPAWNURI DE ALIATI
tank_spawn_wobj
{
   	spawn
	{
	  wait 200
	  setstate tank_spawn_wobj invisible
	}
	trigger off
    {
      setstate tank_spawn_wobj invisible
      setstate tank_spawn_spawns invisible
	  alertentity tank_spawn_spawns
	  wm_announce "Allied spawn lost.."
    }
    trigger on
    {
      setstate tank_spawn_wobj default
      setstate tank_spawn_spawns default
	  alertentity tank_spawn_spawns
      wm_announce "Allied spawn changed at the Heliport!"
    }
	trigger allied_capture 
	{
		//
	}
    trigger axis_capture
    {
	    //
    }
} 
//SPAWNURI DE AXIS
axosu_wobj
{
   	spawn
	{
	  wait 200
	  setstate axosu_wobj invisible
	}
	trigger off
    {
      setstate axosu_wobj invisible
      setstate axosu_pioni invisible
	  alertentity axosu_pioni
    }
    trigger on
    {
      setstate axosu_wobj default
      setstate axosu_pioni default
	  alertentity axosu_pioni
      wm_announce "Axis spawn changed at the Bunker!"
    }
	trigger allied_capture 
	{
		//
	}
    trigger axis_capture
    {
	    //
    }
}
//urcaturi
urcatura1
{
spawn
{
setstate urcatura1 default
}
trigger apare
{
setstate urcatura1 default
}
trigger dispare
{
setstate urcatura1 invisible
}
}